import { extend } from 'umi-request';
import settings from "../settings.js"

const request = extend({
  prefix: settings.prefix+'/path',
//   prefix: 'http://127.0.0.1:5000/path',
//   prefix: 'http://192.168.31.33:5000/path',
//   prefix: 'http://192.168.31.84:5000/path',
//   timeout: 1000,
  headers: {
    'Content-Type': 'multipart/form-data',
  },
});


// 根据拖车号模糊查找，返回一个列表，列表中的元素是一个Trailer对象
export async function getTrailerName(options){
    return request('/getTrailerName',{
        method: "GET",
        ...(options || {}),
    });
}

export async function getLastPosition(trailer_ID){
    return request('/getLastPosition',{
        method: "GET",
        params: {trailer_ID}
    });
}

// 根据trailer_ID查找其对应的path_id们
export async function getPathsByTrailerID(trailer_ID){
    return request('/getPathsByTrailerID',{
        method: "GET",
        params: {trailer_ID},
    });
}

// 根据path_ID查找其对应的path_id们
export async function returnGpsByPathID(path_ID){
    return request('/returnGpsByPathID',{
        method: "GET",
        params: {path_ID},
    });
}